}
wpt = &(wprdata->wpt[idx]);
- WP = waypt_new();
+ WP = new waypoint;
WP->latitude = -pt2deg(wpt->pt.y);
WP->longitude = pt2deg(wpt->pt.x);
WP->SetCreationTime(unpack_time(wpt->date, wpt->time));
/* track points */
trklog = &(trldata.trklog[i]);
for (j=0; j<trkhdr->totalpt; j++) {
- WP = waypt_new();
+ WP = new waypoint;
WP->latitude = -pt2deg(trklog->pt[j].y);
WP->longitude = pt2deg(trklog->pt[j].x);
WP->altitude = hgt2m(trklog->sh[j].height);
for (i = 0; i < count; i++) {
rec = Alloc_AN1_Waypoint();
Read_AN1_Waypoint(f, rec);
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
if (rec->creation_time) {
wpt_tmp->SetCreationTime(rec->creation_time);
Read_AN1_Vertex(f, vert);
/* create route point */
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude = DecodeOrd(vert->lat);
wpt_tmp->longitude = -DecodeOrd(vert->lon);
wpt_tmp->shortname = QString().sprintf("\\%5.5lx", rtserial++);
file_in = gbfopen(arcfileopt, "r", MYNAME);
- arcpt1 = waypt_new();
- arcpt2 = waypt_new();
+ arcpt1 = new waypoint;
+ arcpt2 = new waypoint;
arcdist_arc_disp_hdr_cb(NULL);
arcpt2->latitude = arcpt2->longitude = BADVAL;
arcpt2 = arcpttmp;
}
}
- waypt_free(arcpt1);
- waypt_free(arcpt2);
+ delete arcpt1;
+ delete arcpt2;
gbfclose(file_in);
} else if (rteopt) {
if (ed) {
if ((ed->distance >= pos_dist) == (exclopt == NULL)) {
waypt_del(wp);
- waypt_free(wp);
+ delete wp;
removed++;
} else if (projectopt) {
wp->longitude = ed->prjlongitude;
queue* elem, *tmp;
QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) {
- wpt = waypt_dupe((waypoint*) elem);
+ wpt = new waypoint(*(waypoint*) elem);
waypt_add(wpt);
}
}
fatal(MYNAME ": structure error at %s (Coordinates)!\n", station);
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->shortname = station;
bcr_mercator_to_wgs84(mlat, mlon, &wpt->latitude, &wpt->longitude);
linepart(lat_orig, long_orig, lat_orig_adj, long_orig_adj, frac,
&lat_dest, &long_dest);
- wpt_dest = waypt_dupe(wpt_orig);
+ wpt_dest = new waypoint(*wpt_orig);
wpt_dest->latitude = DEG(lat_dest);
wpt_dest->longitude = DEG(long_dest);
if (wpt_orig_prev == NULL) {
if (wpt_orig != NULL) {
- waypoint* waypoint_dest = waypt_dupe(wpt_orig);
+ waypoint* waypoint_dest = new waypoint(*wpt_orig);
route_add_wpt(route_dest, waypoint_dest);
}
} else {
if (is_small_angle(lat_orig, long_orig, lat_orig_prev,
long_orig_prev, lat_orig_next, long_orig_next)) {
- waypoint* waypoint_dest = waypt_dupe(wpt_orig);
+ waypoint* waypoint_dest = new waypoint(*wpt_orig);
route_add_wpt(route_dest, waypoint_dest);
} else {
waypoint* wpt_dest_prev = create_wpt_dest(wpt_orig,
}
if (wpt_orig != NULL) {
- waypoint* waypoint_dest = waypt_dupe(wpt_orig);
+ waypoint* waypoint_dest = new waypoint(*wpt_orig);
route_add_wpt(route_dest, waypoint_dest);
}
}
break;
case st_sample_alt:
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = wpt->longitude = 0.0;
wpt->SetCreationTime(creation);
creation += interval;
int32_t lat_tmp,lon_tmp;
unsigned int proximity;
unsigned int icon;
- waypoint* wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = new waypoint;
lat_tmp = gbfgetint32(file_in);
lon_tmp = gbfgetint32(file_in);
break;
}
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude = lat_tmp / 10000000.0;
wpt_tmp->longitude = lon_tmp / 10000000.0;
{
int col = -1;
char* c, *cx;
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
struct tm tm;
int has_time = 0;
memset(&tm, 0, sizeof(tm));
int col = -1;
char* c;
struct tm tm;
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
c = strstr(buff, "A ");
if (c == buff) {
}
if (wpt->shortname != NULL) {
- waypt_add(waypt_dupe(wpt));
+ waypt_add(new waypoint(*wpt));
// Rather than creating a new waypt on each read, tis format bizarrely
- // recycles the same one, relying on waypt_dupe() above and then manually
+ // recycles the same one, relying on new waypoint(*) above and then manually
// resetting fields. Weird.
wpt->url_link_list_.clear();
temp_route = route_head_alloc();
route_add_head(temp_route);
}
- route_add_wpt(temp_route, waypt_dupe(wpt));
+ route_add_wpt(temp_route, new waypoint(*wpt));
}
track_add_wpt((route_head*)track, (waypoint*)wpt);
}
wpt = NULL;
- wpt = waypt_new();
+ wpt = new waypoint;
if (5 != sscanf(cin, "%lf %lf %lf %d %s",
&wpt->longitude,
}
break;
case XT_GEOCACHE_LAST_FOUND:
- waypt_alloc_gc_data(wpt)->last_found = yyyymmdd_to_time(s);
+ wpt->AllocGCData()->last_found = yyyymmdd_to_time(s);
break;
/* GEOCACHING STUFF ***************************************************/
case XT_GEOCACHE_DIFF:
/* Geocache Difficulty as an int */
- waypt_alloc_gc_data(wpt)->diff = atof(s) * 10;
+ wpt->AllocGCData()->diff = atof(s) * 10;
break;
case XT_GEOCACHE_TERR:
/* Geocache Terrain as an int */
- waypt_alloc_gc_data(wpt)->terr = atof(s) * 10;
+ wpt->AllocGCData()->terr = atof(s) * 10;
break;
case XT_GEOCACHE_TYPE:
/* Geocache Type */
- waypt_alloc_gc_data(wpt)->type = gs_mktype(s);
+ wpt->AllocGCData()->type = gs_mktype(s);
break;
case XT_GEOCACHE_CONTAINER:
- waypt_alloc_gc_data(wpt)->container = gs_mkcont(s);
+ wpt->AllocGCData()->container = gs_mkcont(s);
break;
case XT_GEOCACHE_HINT:
- waypt_alloc_gc_data(wpt)->hint = QString(s).trimmed();
+ wpt->AllocGCData()->hint = QString(s).trimmed();
break;
case XT_GEOCACHE_PLACER:
- waypt_alloc_gc_data(wpt)->placer = QString(s).trimmed();
+ wpt->AllocGCData()->placer = QString(s).trimmed();
break;
case XT_GEOCACHE_ISAVAILABLE:
- gc_data = waypt_alloc_gc_data(wpt);
+ gc_data = wpt->AllocGCData();
if (case_ignore_strcmp(csv_stringtrim(s, ""), "False") == 0) {
gc_data->is_available = status_false;
} else if (case_ignore_strcmp(csv_stringtrim(s, ""), "True") == 0) {
}
break;
case XT_GEOCACHE_ISARCHIVED:
- gc_data = waypt_alloc_gc_data(wpt);
+ gc_data = wpt->AllocGCData();
if (case_ignore_strcmp(csv_stringtrim(s, ""), "False") == 0) {
gc_data->is_archived = status_false;
} else if (case_ignore_strcmp(csv_stringtrim(s, ""), "True") == 0) {
}
if (strlen(buff)) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
s = buff;
s = csv_lineparse(s, xcsv_file.field_delimiter,
static waypoint*
decode_waypoint(const void* data)
{
- waypoint* wp = waypt_new();
+ waypoint* wp = new waypoint;
const msg_waypoint_t* p = (const msg_waypoint_t*)data;
const char* s;
float f;
float elev = UNKNOWN_ELEV;
char* pp;
- if (waypt_empty_gc_data(wp)) {
+ if (wp->EmptyGCData()) {
notes = xstrdup(wp->notes);
if (notes == NULL && wp->description.isEmpty() && wp->shortname != wp->description) {
notes = xstrdup(wp->description);
fatal(MYNAME ": read too many track points\n");
}
for (i = 0; i < n; i++, j++) {
- waypoint* wp = waypt_new();
+ waypoint* wp = new waypoint;
float elev = le_read_float(p->point[i].elevation);
wp_array[j] = wp;
wp->SetCreationTime(decode_time(&p->point[i].year));
for (i = 0; i < n; i++, j++) {
char buf[32];
- waypoint* wp = waypt_new();
+ waypoint* wp = new waypoint;
wp_array[j] = wp;
wp->latitude = delbin_rad2deg(le_read32(p->point[i].latitude));
wp->longitude = delbin_rad2deg(le_read32(p->point[i].longitude));
const msg_route_point_t* p = (const msg_route_point_t*) data;
const char* s = NULL;
gbfile* fd = gbfopen(NULL, "w", MYNAME);
- waypoint* wp = waypt_new();
+ waypoint* wp = new waypoint;
if (p->name[0]) {
wp->shortname = p->name;
}
static waypoint*
decode_navmsg(const void* data)
{
- waypoint* wp = waypt_new();
+ waypoint* wp = new waypoint;
const msg_navigation_t* p = (const msg_navigation_t*) data;
struct tm t;
track_add_head(track_head);
while (gbfread(&gp, sizeof(gp), 1, gplfile_in) > 0) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude = le_read_double(&gp.lat);
wpt_tmp->longitude = le_read_double(&gp.lon);
alt_feet = le_read_double(&gp.alt);
// in time. The only thing I see "special" about those
// trackpoints is that these fields are zeroed. Toss them.
if ((wpt_tmp->speed == 0.0) && (wpt_tmp->course == 0.0)) {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
continue;
}
track_add_wpt(track_head, wpt_tmp);
count++;
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->shortname = read_wcstr(0);
wpt->notes = read_wcstr(0); /* comment */
count++;
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->shortname = read_wcstr(0);
wpt->notes = read_wcstr(0);
break;
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->longitude = gbfgetdbl(fin);
wpt->latitude = gbfgetdbl(fin);
track_add_head(*track);
}
- wpt = waypt_new();
+ wpt = new waypoint;
latitude = bin2deg(lat);
if (latitude >= 100) {
manual_point = 1;
default:
return;
}
- waypt_free(waypointp);
+ delete waypointp;
}
}
static void
tlog3b_xgcb_wptst(xg_string args, const QXmlStreamAttributes* unused)
{
- xmlwpt = waypt_new();
+ xmlwpt = new waypoint;
xmldatum = DATUM_WGS84;
}
static void
tlog3b_xgcb_tptst(xg_string args, const QXmlStreamAttributes* unused)
{
- xmlwpt = waypt_new();
+ xmlwpt = new waypoint;
xmldatum = DATUM_WGS84;
}
datum = read_datum(fin);
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = gbfgetdbl(fin);
wpt->longitude = gbfgetdbl(fin);
gbfungetc(i, fin);
datum = read_datum(fin);
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = gbfgetdbl(fin);
wpt->longitude = gbfgetdbl(fin);
wcount--;
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = gbfgetdbl(fin);
wpt->longitude = gbfgetdbl(fin);
if (btmp == NULL) {
if (delwpt) {
- waypt_free(delwpt);
+ delete delwpt;
}
if (correct_coords && oldnode && oldnode->wpt) {
oldnode->wpt->latitude = waypointp->latitude;
if (purge_duplicates && oldnode) {
if (oldnode->wpt) {
waypt_del(oldnode->wpt);
- waypt_free(oldnode->wpt);
+ delete oldnode->wpt;
oldnode->wpt = NULL;
}
}
}
if (delwpt) {
- waypt_free(delwpt);
+ delete delwpt;
}
xfree(htable);
unsigned char tag;
waypoint* wpt_tmp;
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
UrlLink link;
for (tag = gbfgetc(file_in); tag != 0xff; tag = gbfgetc(file_in)) {
route_add_head(route);
while (1 == gbfread(&ewpt, sizeof(ewpt), 1, file_in)) {
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
wpt->latitude = enigmaPositionToDec(le_read32(&ewpt.latitude));
wpt->longitude = enigmaPositionToDec(le_read32(&ewpt.longitude));
char*sn = xstrndup(ewpt.shortname, ewpt.shortname_len);
return NULL;
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = unknown_alt;
wpt->longitude = unknown_alt;
//
// For waypoints:
// while (have waypoints) {
-// waypoint = waypt_new()
+// waypoint = new waypoint
// populate waypoint
// waypt_add(waypoint);
// }
// populate struct route_hdr
// route_add_head(route);
// while (have more routepoints) {
-// waypoint = waypt_new()
+// waypoint = new waypoint
// populate waypoint
// route_add_wpt(route, waypoint)
// }
waypoint* wpt;
garmin_fs_p gmsd;
- wpt = waypt_new();
+ wpt = new waypoint;
gmsd = garmin_fs_alloc(-1);
fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
garmin_fs_p gmsd;
waypoint* wpt;
- wpt = waypt_new();
+ wpt = new waypoint;
gmsd = garmin_fs_alloc(-1);
fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
break;
case 'I': /* event point */
- wpt = waypt_new();
+ wpt = new waypoint;
cdata += parse_coordinates(cdata, datum, grid,
&wpt->latitude, &wpt->longitude, MYNAME);
xasprintf(&wpt->shortname, "Event%d", ++event_ct);
GPS_PWay* way = NULL;
if (getposn) {
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
wpt->latitude = gps_save_lat;
wpt->longitude = gps_save_lon;
wpt->shortname = "Position";
}
for (i = 0; i < n; i++) {
- waypoint* wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = new waypoint;
wpt_tmp->shortname = way[i]->ident;
wpt_tmp->description = QString(way[i]->cmnt).simplified();
if (array[i]->no_latlon || array[i]->ishdr) {
continue;
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->longitude = array[i]->lon;
wpt->latitude = array[i]->lat;
if (array[i]->islink) {
continue;
} else {
- waypoint* wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = new waypoint;
wpt_tmp->latitude = array[i]->lat;
wpt_tmp->longitude = array[i]->lon;
wpt_tmp->shortname = array[i]->ident;
trk_head->rte_name = tbuf;
track_add_head(trk_head);
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->longitude = array[i]->begin_lon;
wpt->latitude = array[i]->begin_lat;
* continue;
* }
*/
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->longitude = array[i]->end_lon;
wpt->latitude = array[i]->end_lat;
static waypoint*
pvt_read(posn_status* posn_status)
{
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
GPS_PPvt_Data pvt = GPS_Pvt_New();
if (GPS_Command_Pvt_Get(&pvt_fd, &pvt)) {
fatal(MYNAME ": Fatal error reading position.\n");
}
- waypt_free(wpt);
+ delete wpt;
GPS_Pvt_Del(&pvt);
return NULL;
break;
}
- waypt = waypt_new();
+ waypt = new waypoint;
waypt->latitude = (lat / (double)0x7fffffff) * 180;
waypt->longitude = (lon / (double)0x7fffffff) * 180;
if (alt != 0xffff) {
(void) len;
pos = gbftell(fin);
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->icon_descr = DEFAULT_ICON;
wpt->latitude = GPS_Math_Semi_To_Deg(gbfgetint32(fin));
}
xfree(dt);
}
- waypt_free(wpt);
+ delete wpt;
}
if (data->top_left) {
}
}
- wpt = waypt_dupe(ref);
+ wpt = new waypoint(*ref);
if (*opt_unique == '1') {
#if NEW_STRINGS
bind_fields(waypt_header);
- wpt = waypt_new();
+ wpt = new waypoint;
gmsd = garmin_fs_alloc(-1);
fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
is_fatal((*str == '\0'), MYNAME ": Route waypoint without name at line %d!\n", current_line);
wpt = find_waypt_by_name(str);
is_fatal((wpt == NULL), MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", str, current_line);
- wpt = waypt_dupe(wpt);
+ wpt = new waypoint(*wpt);
break;
}
}
waypoint* wpt;
bind_fields(trkpt_header);
- wpt = waypt_new();
+ wpt = new waypoint;
while ((str = csv_lineparse(NULL, "\t", "", column++))) {
int field_no;
// Add point to the track if not the first point
if (!FirstCoo) {
//create new waypoint
- wpt = waypt_new();
+ wpt = new waypoint;
//populate wpt;
wpt->latitude = PrevLat; /* Degrees */
format_garmin_xt_decomp_last_ele(Count, &PrevEle, TrackBlock);
//create new waypoint
- wpt = waypt_new();
+ wpt = new waypoint;
//populate wpt;
wpt->latitude = PrevLat; /* Degrees */
AltF = (double)uu * GARMIN_XT_ELE - 1500;
//create new waypoint
- wpt = waypt_new();
+ wpt = new waypoint;
//populate wpt;
wpt->latitude = LatF*180/16777216; /* Degrees */
xfree(wpt->extra_data);
#endif
}
- waypt_free(wpt);
+ delete wpt;
}
}
turn_point = (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && tmp->description);
#endif
if (turn_point || (gdb_via == 0) || (wpt_class < gt_waypt_class_map_point)) {
- res = waypt_dupe(tmp);
+ res = new waypoint(*tmp);
route_add_wpt(rte, res);
}
- waypt_free(ref);
+ delete ref;
return res;
}
char* sn;
#endif
waypt_ct++;
- res = waypt_new();
+ res = new waypoint;
gmsd = garmin_fs_alloc(-1);
fs_chain_add(&res->fs, (format_specific_data*) gmsd);
waypoint* wpt;
- wpt = waypt_new();
+ wpt = new waypoint;
rtept_ct++;
wpt->shortname = fread_cstr(); /* shortname */
/* Without links we need all informations from wpt */
waypoint* tmp = gdb_reader_find_waypt(wpt, 0);
if (tmp != NULL) {
- waypt_free(wpt);
- wpt = waypt_dupe(tmp);
+ delete wpt;
+ wpt = new waypoint(*tmp);
} else {
if (waypt_bounds_valid(&bounds)) {
warning(MYNAME ": (has bounds)\n");
points = FREAD_i32;
for (index = 0; index < points; index++) {
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
trkpt_ct++;
if ((gdb_via == 0) || (wpt_class == 0)) {
waypoint* dupe;
waypt_add(wpt);
- dupe = waypt_dupe(wpt);
+ dupe = new waypoint(*wpt);
ENQUEUE_TAIL(&wayptq_in, &dupe->Q);
} else {
ENQUEUE_TAIL(&wayptq_in_hidden, &wpt->Q);
#else
char* name;
#endif
- waypoint* wpt = waypt_dupe(refpt);
+ waypoint* wpt = new waypoint(*refpt);
gdb_check_waypt(wpt);
ENQUEUE_TAIL(&wayptq_out, &wpt->Q);
current_tag.append("/");
current_tag.append(tag_name);
if (current_tag == "/loc/waypoint") {
- wpt = waypt_new();
- waypt_alloc_gc_data(wpt);
+ wpt = new waypoint;
+ wpt->AllocGCData();
// There is no 'unknown' alt value and so many reference files have
// leaked it that we just paper over that here.
wpt->altitude = 0;
memset(&tm, 0, sizeof(tm));
- wpt = waypt_new();
+ wpt = new waypoint;
deg = (int16_t) le_read16(&buf[0]);
min = le_read16(&buf[2]);
for (j = 0; j < points; j++) {
- wpt = waypt_new();
+ wpt = new waypoint;
snprintf(coord, sizeof(coord), "YKoord%d", j);
if ((cx = inifile_readstr(inifile, symbol, coord))) {
case OVL_SYMBOL_CIRCLE:
case OVL_SYMBOL_TRIANGLE:
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->shortname = symbol;
if ((cx = inifile_readstr(inifile, symbol, "YKoord"))) {
void gl_trk_pnt_s(xg_string args, const QXmlStreamAttributes* unused)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
}
void gl_trk_pnt_e(xg_string args, const QXmlStreamAttributes* unused)
fatal(MYNAME ": Unexpected EOF (end of file)!\n");
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->SetCreationTime(le_read32(&rec.time));
wpt->latitude = le_read_float(&rec.lat);
}
{
- waypoint* wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = new waypoint;
wpt_tmp->latitude = lat / 100000.0;
wpt_tmp->longitude = lon / 100000.0;
wpt_tmp->route_priority=level;
lon += decode_goog64(&str);
{
- waypoint* wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = new waypoint;
wpt_tmp->latitude = lat / 100000.0;
wpt_tmp->longitude = lon / 100000.0;
/* FIXME no need for name
if ((nfields == 8) && (tx == 0)) {
// fatal(MYNAME ": Invalid date in filename \"%s\", try to set manually using \"date\" switch!\n", buff);
}
- wpt = waypt_new();
+ wpt = new waypoint;
column = -1;
// the format of gopal is quite simple. Unfortunately the developers forgot the date as the first element...
long_old=wpt->longitude;
lat_old=wpt->latitude;
route_add_wpt(route,wpt);
- waypt_add(waypt_dupe(wpt));
+ waypt_add(new waypoint(*wpt));
}
}
}
rtrim(sn);
rtrim(desc);
rtrim(icon);
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->altitude = alt;
wpt_tmp->shortname = sn;
xfree(sn);
static void
tag_wpt(const QXmlStreamAttributes& attr)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
link_ = new UrlLink;
cur_tag = NULL;
static void
tag_gs_cache(const QXmlStreamAttributes& attr)
{
- geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
+ geocache_data* gc_data = wpt_tmp->AllocGCData();
if (attr.hasAttribute("id")) {
gc_data->id = attr.value("id").toString().toInt();
tag_log_wpt(const QXmlStreamAttributes& attr)
{
/* create a new waypoint */
- waypoint* lwp_tmp = waypt_new();
+ waypoint* lwp_tmp = new waypoint;
/* extract the lat/lon attributes */
if (attr.hasAttribute("lat")) {
break;
case tt_cache_placer:
if (attr.hasAttribute("id")) {
- waypt_alloc_gc_data(wpt_tmp)->placer_id = attr.value("id").toString().toInt();
+ wpt_tmp->AllocGCData()->placer_id = attr.value("id").toString().toInt();
}
default:
break;
wpt_tmp->notes = cdatastr;
break;
case tt_cache_container:
- waypt_alloc_gc_data(wpt_tmp)->container = gs_mkcont(cdatastr);
+ wpt_tmp->AllocGCData()->container = gs_mkcont(cdatastr);
break;
case tt_cache_type:
- waypt_alloc_gc_data(wpt_tmp)->type = gs_mktype(cdatastr);
+ wpt_tmp->AllocGCData()->type = gs_mktype(cdatastr);
break;
case tt_cache_difficulty:
x = cdatastr.toDouble();
- waypt_alloc_gc_data(wpt_tmp)->diff = x * 10;
+ wpt_tmp->AllocGCData()->diff = x * 10;
break;
case tt_cache_hint:
- waypt_alloc_gc_data(wpt_tmp)->hint = cdatastr.trimmed();
+ wpt_tmp->AllocGCData()->hint = cdatastr.trimmed();
break;
case tt_cache_desc_long: {
- geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
+ geocache_data* gc_data = wpt_tmp->AllocGCData();
gc_data->desc_long.is_html = cache_descr_is_html;
// FIXME: Forcing a premature conversion here saves 4% on GPX read times
// on large PQs. Once cdatastrp becomes real QString this is just (minimal)
break;
case tt_cache_desc_short:
{
- geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
+ geocache_data* gc_data = wpt_tmp->AllocGCData();
gc_data->desc_short.is_html = cache_descr_is_html;
gc_data->desc_short.utfstring = cdatastr;
}
break;
case tt_cache_terrain:
x = cdatastr.toDouble();
- waypt_alloc_gc_data(wpt_tmp)->terr = x * 10;
+ wpt_tmp->AllocGCData()->terr = x * 10;
break;
case tt_cache_placer:
- waypt_alloc_gc_data(wpt_tmp)->placer = cdatastr;
+ wpt_tmp->AllocGCData()->placer = cdatastr;
break;
case tt_cache_log_date:
gc_log_date = xml_parse_time(cdatastr);
case tt_cache_log_type:
if ((cdatastr.compare("Found it") == 0) &&
(0 == wpt_tmp->gc_data->last_found.toTime_t())) {
- waypt_alloc_gc_data(wpt_tmp)->last_found = gc_log_date;
+ wpt_tmp->AllocGCData()->last_found = gc_log_date;
}
gc_log_date = QDateTime();
break;
case tt_cache_favorite_points:
- waypt_alloc_gc_data(wpt_tmp)->favorite_points = cdatastr.toInt();
+ wpt_tmp->AllocGCData()->favorite_points = cdatastr.toInt();
break;
case tt_cache_personal_note:
- waypt_alloc_gc_data(wpt_tmp)->personal_note = cdatastr;
+ wpt_tmp->AllocGCData()->personal_note = cdatastr;
break;
/*
/* Waypoints */
for (i = 0; i != wp_count; i++) {
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = fread_double(file_in);
wpt->longitude = fread_double(file_in);
convert_datum(&wpt->latitude, &wpt->longitude);
/* Tracklogs */
for (i = 0; i != tr_count; i++) {
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = fread_double(file_in);
wpt->longitude = fread_double(file_in);
convert_datum(&wpt->latitude, &wpt->longitude);
/* Routes */
for (i = 0; i != rt_count; i++) {
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = fread_double(file_in);
wpt->longitude = fread_double(file_in);
convert_datum(&wpt->latitude, &wpt->longitude);
void
gtc_trk_pnt_s(xg_string unused, const QXmlStreamAttributes* unusedattrs)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
}
void
/* Add the first point of an ActivityLap as
a waypoint as well as a trackpoint. */
char cbuf[10];
- waypoint* wpt_lap_s = waypt_dupe(wpt_tmp);
+ waypoint* wpt_lap_s = new waypoint(*wpt_tmp);
snprintf(cbuf, sizeof(cbuf), "LAP%03d", lap_ct);
wpt_lap_s->shortname = cbuf;
waypt_add(wpt_lap_s);
track_add_wpt(trk_head, wpt_tmp);
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
wpt_tmp = NULL;
gtc_wpt_crs_s(const char* unused, const QXmlStreamAttributes* unusedattrs)
#endif
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
}
void
if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) {
waypt_add(wpt_tmp);
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
wpt_tmp = NULL;
void
gtc_wpt_pnt_s(xg_string unused, const QXmlStreamAttributes* unusedattrs)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
lap_ct++;
}
wpt_tmp->shortname = QString().sprintf("LAP%03d", lap_ct);
waypt_add(wpt_tmp);
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
wpt_tmp = NULL;
static
void ht_wpt_s(xg_string args, const QXmlStreamAttributes* unused)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
}
static
static
void ht_trk_pnt_s(xg_string args, const QXmlStreamAttributes* unused)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
}
static
/* Get the waypoints */
for (iCount = 0; iCount < iWptNum ; iCount ++) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
iWptIndex = le_read16(&((WPTHDR*)HxWpt)->idx[iCount]);
pWptHxTmp = (WPT*)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)];
/* All right! Copy the data to the gpsbabel struct... */
- wpt = waypt_new();
+ wpt = new waypoint;
// Could probably find a way to eliminate the alloc/copy.
char *s = xstrndup(w.name, sizeof(w.name));
// that describes a sub-status
switch (w.status) {
case 0: // Waypoint not used. So why do we have one?
- waypt_free(wpt);
+ delete wpt;
break;
case 1: // Waypoint permanent.
case 2: // Waypoint temporary.
case 17: // Waypoint group body.
case 63: // Waypoint group invalid.
default:
- waypt_free(wpt);
+ delete wpt;
break;
}
xfree(s);
/* rte->rte_num = hrte.num + 1; only internal number */
}
- route_add_wpt(rte, waypt_dupe(wpt));
+ route_add_wpt(rte, new waypoint(*wpt));
}
}
}
/* We create one wpt for the info in the header */
- first_wpt = waypt_new();
+ first_wpt = new waypoint;
g_lat = gudermannian_i1924(accum_north);
first_wpt->latitude = geocentric_to_geodetic_hwr(g_lat);
first_wpt->longitude = accum_east/EAST_SCALE * 180.0;
track_add_wpt(trk, first_wpt);
for (i=0 ; i<th.num_points-1 ; i++) {
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
int16_t next_deltaeast, next_deltanorth;
double guder;
/* We create one wpt for the info in the header */
- first_wpt = waypt_new();
+ first_wpt = new waypoint;
g_lat = gudermannian_i1924(accum_north);
first_wpt->latitude = geocentric_to_geodetic_hwr(g_lat);
first_wpt->longitude = accum_east/EAST_SCALE * 180.0;
track_add_wpt(trk, first_wpt);
for (i=0 ; i<th.num_points-1 ; i++) {
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
// int16_t next_deltaeast, next_deltanorth;
double guder;
fatal(MYNAME ": task waypoint (C) record parse error\n%s", rec);
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = ('N' == lat_hemi[0] ? 1 : -1) *
(lat_deg + (lat_min * 1000 + lat_frac) / 1000.0 / 60);
// Zero lat and lon indicates an unknown waypoint
if (coords_match(wpt->latitude, wpt->longitude, 0.0, 0.0)) {
- waypt_free(wpt);
+ delete wpt;
return;
}
wpt->shortname = short_name;
&validity, &pres_alt, &gnss_alt) != 14) {
fatal(MYNAME ": fix (B) record parse error\n%s\n", ibuf);
}
- pres_wpt = waypt_new();
+ pres_wpt = new waypoint;
pres_wpt->latitude = ('N' == lat_hemi[0] ? 1 : -1) *
(lat_deg + (lat_min * 1000 + lat_frac) / 1000.0 / 60);
// Add the same waypoint with GNSS altitude to the second
// track
- gnss_wpt = waypt_dupe(pres_wpt);
+ gnss_wpt = new waypoint(*pres_wpt);
if (gnss_alt) {
gnss_valid = 1;
{
ignr_xml_error((wpt != NULL));
- wpt = waypt_new();
+ wpt = new waypoint;
}
static void
while (in_point_count &&
gbfread(&point, sizeof(point), 1, igo8_file_in) > 0) {
in_point_count--;
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude = le_read32(&point.lat) / (double)0x800000;
wpt_tmp->longitude = le_read32(&point.lon) / (double)0x800000;
static void
iktobj_trkpt(xg_string args, const QXmlStreamAttributes* attrv)
{
- waypt = waypt_new();
+ waypt = new waypoint;
iktobj_waypt(args, attrv);
track_add_wpt(track, waypt);
waypt = NULL;
switch (atoi(args)) {
#endif
case 0:
- waypt = waypt_new();
+ waypt = new waypoint;
break;
case 1:
track = route_head_alloc();
for (timen = time1+interval;
timen < wpt->creation_time.toTime_t();
timen += interval) {
- waypoint* wpt_new = waypt_dupe(wpt);
+ waypoint* wpt_new = new waypoint(*wpt);
wpt_new->SetCreationTime(timen);
#if NEW_STRINGS
wpt_new->shortname = QString();
for (distn = dist;
distn < curdist;
distn += dist) {
- waypoint* wpt_new = waypt_dupe(wpt);
+ waypoint* wpt_new = new waypoint(*wpt);
wpt_new->SetCreationTime(distn/curdist*
(wpt->creation_time.toTime_t() - time1) + time1);
#if NEW_STRINGS
}
}
if (opt_route) {
- route_add_wpt(rte_new, waypt_dupe(wpt));
+ route_add_wpt(rte_new, new waypoint(*wpt));
} else {
- track_add_wpt(rte_new, waypt_dupe(wpt));
+ track_add_wpt(rte_new, new waypoint(*wpt));
}
lat1 = wpt->latitude;
to_waypoint(itracku_data_record* d)
{
waypoint* wp;
- wp = waypt_new();
+ wp = new waypoint;
wp->longitude = deg_min_to_deg(le_read32(d->longitude));
wp->latitude = deg_min_to_deg(le_read32(d->latitude));
wp->SetCreationTime(decode_itracku_time(le_read32(d->creation_time)));
dmy = dmy / 100;
tm.tm_mday = dmy;
- waypt = waypt_new();
+ waypt = new waypoint;
WAYPT_SET(waypt, speed, KNOTS_TO_MPS(speed));
static void
jogmap_marker(xg_string args, const QXmlStreamAttributes* attrv)
{
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
if (attrv->hasAttribute("lat")) {
wpt->latitude = attrv->value("lat").toString().toDouble();
continue;
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = lat;
wpt->longitude = lon;
void wpt_s(xg_string args, const QXmlStreamAttributes* unused)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp_queued = 0;
}
if (wpt_tmp_queued) {
waypt_add(wpt_tmp);
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
wpt_tmp_queued = 0;
}
}
track_add_head(trk_head);
while ((n = sscanf(CSTR(iargs), "%lf,%lf,%lf%n", &lon, &lat, &alt, &consumed)) > 0) {
- trkpt = waypt_new();
+ trkpt = new waypoint;
trkpt->latitude = lat;
trkpt->longitude = lon;
if (radtometers(gcdist(RAD(wpt->latitude), RAD(wpt->longitude),
RAD(newest_posn->latitude), RAD(newest_posn->longitude))) > 50) {
- track_add_wpt(posn_trk_head, waypt_dupe(wpt));
+ track_add_wpt(posn_trk_head, new waypoint(*wpt));
} else {
/* If we haven't move more than our threshold, pretend
* we didn't move at all to prevent Earth from jittering
static void
lmx_lm_start(xg_string args, const QXmlStreamAttributes* unused)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
}
static void
/* waypoints */
for (j=0; j < num_legs; j++) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
lowranceusr_parse_waypt(wpt_tmp);
route_add_wpt(rte_head, wpt_tmp);
}
(void) gbfread(&buff[0], 4, 1, file_in);
} else {
waypoint* wpt_tmp;
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
/* position coord lat & long */
wpt_tmp->latitude = lat_mm_to_deg(gbfgetint32(file_in));
}
for (j=0; j < num_section_points; j++, num_trail_points--) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude = lat_mm_to_deg(gbfgetint32(file_in));
wpt_tmp->longitude = lon_mm_to_deg(gbfgetint32(file_in));
/* continuous */
for (i = 0; i < NumWaypoints; i++) {
waypoint* wpt_tmp;
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
/* Object num */
object_num = gbfgetint16(file_in);
for (i = 0; i < num_waypts; ++i) {
waypoint* wpt_tmp;
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
lowranceusr4_fsdata* fsdata = lowranceusr4_alloc_fsdata();
fs_chain_add(&(wpt_tmp->fs), (format_specific_data*) fsdata);
printf(MYNAME " parse_routes: added wpt %s to route %s\n",
CSTRc(wpt_tmp->shortname), CSTRc(rte_head->rte_name));
}
- route_add_wpt(rte_head, waypt_dupe(wpt_tmp));
+ route_add_wpt(rte_head, new waypoint(*wpt_tmp));
}
}
}
for (j = 0; j < num_trail_pts; ++j) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
/* Some unknown bytes */
gbfgetint16(file_in);
buff += 9; /* skip field no. 1 */
fld = 1;
- wpt_tmp = waypt_new();
- gcdata = waypt_alloc_gc_data(wpt_tmp);
+ wpt_tmp = new waypoint;
+ gcdata = wpt_tmp->AllocGCData();
while ((s = csv_lineparse(buff, ",", "", fld++))) {
buff = NULL;
struct tm tm;
waypoint* waypt;
- waypt = waypt_new();
+ waypt = new waypoint;
memset(&tm, 0, sizeof(tm));
#else
if (strcmp(waypt->shortname, re->wpt_name) == 0) {
#endif
- waypoint* wpt = waypt_dupe(waypt);
+ waypoint* wpt = new waypoint(*waypt);
route_add_wpt(rte_head, wpt);
break;
}
descr[0] = 0;
icon_token[0] = 0;
- waypt = waypt_new();
+ waypt = new waypoint;
sscanf(trkmsg,"$PMGNWPL,%lf,%c,%lf,%c,%d,%c,%[^,],%[^,]",
&latdeg,&latdir,
if (tracking_status.request_terminate) {
if (wpt) {
- waypt_free(wpt);
+ delete wpt;
}
break;
}
/* Just print to screen */
waypt_disp(wpt);
}
- waypt_free(wpt);
+ delete wpt;
}
}
if (ivecs->position_ops.rd_deinit) {
continue;
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = lat;
wpt->longitude = lon;
#if 0 /* unsure, not validated items */
wpt->fix = buff[TR7_S_FIX];
if (buff[TR7_S_VALID] != 'A') {
- waypt_free(wpt);
+ delete wpt;
continue;
}
#endif
if (waypt_speed(prev, wpt) > 9999.9) { /* filter out some bad trackpoints */
- waypt_free(wpt);
+ delete wpt;
continue;
}
int longitude = gbfgetint32(fin);
int latitude = gbfgetint32(fin);
- waypoint* ret = waypt_new();
+ waypoint* ret = new waypoint;
ret->latitude = double(latitude)/DIV_RATE;
ret->longitude = double(longitude)/DIV_RATE;
wpt_count = gbfgetint32(mapsend_file_in);
while (wpt_count--) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->shortname = gbfgetpstr(mapsend_file_in);
wpt_tmp->description = gbfgetpstr(mapsend_file_in);
wpt_count = gbfgetint32(mapsend_file_in);
while (wpt_count--) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
/* waypoint name */
wpt_tmp->shortname = gbfgetpstr(mapsend_file_in);
trk_count = gbfgetuint32(mapsend_file_in);
while (trk_count--) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->longitude = gbfgetdbl(mapsend_file_in);
wpt_tmp->latitude = -gbfgetdbl(mapsend_file_in);
QUEUE_FOR_EACH(whichQueue, elem, tmp) {
waypoint* q = (waypoint*) dequeue(elem);
- waypt_free(q);
+ delete q;
}
}
void
mps_wpt_q_add(const queue* whichQueue, const waypoint* wpt)
{
- waypoint* written_wpt = waypt_dupe(wpt);
+ waypoint* written_wpt = new waypoint(*wpt);
ENQUEUE_TAIL(whichQueue, &written_wpt->Q);
}
double mps_proximity = unknown_alt;
double mps_depth = unknown_alt;
- thisWaypoint = waypt_new();
+ thisWaypoint = new waypoint;
*wpt = thisWaypoint;
mps_readstr(mps_file, wptname, sizeof(wptname));
((wpt->longitude - wptfound->longitude) != 0)) {
/* Not the same lat lon, so rename and add */
newName = mkshort(written_wpt_mkshort_handle, wpt->shortname);
- wptfound = waypt_dupe(wpt);
+ wptfound = new waypoint(*wpt);
xfree(wptfound->shortname);
wptfound->shortname = newName;
mps_waypoint_w(mps_file_out, mps_ver_out, wptfound, (1==0));
tempWpt = find_waypt_by_name(wptname);
if (tempWpt != NULL) {
- thisWaypoint = waypt_dupe(tempWpt);
+ thisWaypoint = new waypoint(*tempWpt);
} else {
tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname);
if (tempWpt != NULL) {
- thisWaypoint = waypt_dupe(tempWpt);
+ thisWaypoint = new waypoint(*tempWpt);
} else {
/* should never reach here, but we do need a fallback position */
#ifdef MPS_DEBUG
fprintf(stderr, "mps_route_r: reached the point we never should\n");
#endif
- thisWaypoint = waypt_new();
+ thisWaypoint = new waypoint;
thisWaypoint->shortname = wptname;
thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
tempWpt = find_waypt_by_name(wptname);
if (tempWpt != NULL) {
- thisWaypoint = waypt_dupe(tempWpt);
+ thisWaypoint = new waypoint(*tempWpt);
} else {
tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname);
if (tempWpt != NULL) {
- thisWaypoint = waypt_dupe(tempWpt);
+ thisWaypoint = new waypoint(*tempWpt);
} else {
/* should never reach here, but we do need a fallback position */
- thisWaypoint = waypt_new();
+ thisWaypoint = new waypoint;
thisWaypoint->shortname = wptname;
thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
gbfseek(mps_file, 8, SEEK_CUR);
}
- thisWaypoint = waypt_new();
+ thisWaypoint = new waypoint;
thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
thisWaypoint->SetCreationTime(dateTime);
fprintf(stderr,"Lost sync with the file reading waypoint - %s\n", wpt->shortname);
#endif
gbfseek(mps_file_in, mpsFileInPos + reclen, SEEK_SET);
- waypt_free(wpt);
+ delete wpt;
} else {
/* only add to the "real" list if a "user" waypoint otherwise add to the private list */
if (mpsWptClass == MPSDEFAULTWPTCLASS) {
waypt_add(wpt);
} else {
mps_wpt_q_add(&read_route_wpt_head, wpt);
- waypt_free(wpt);
+ delete wpt;
}
#ifdef DUMP_ICON_TABLE
printf("\t{ %4u, \"%s\" },\n", icon, wpt->shortname);
since we're here because the user didn't request waypoints, this should be acceptable */
mps_waypoint_r(mps_file_temp, mps_ver_temp, &wpt, &mpsWptClass);
mps_wpt_q_add(&written_wpt_head, wpt);
- waypt_free(wpt);
+ delete wpt;
/* now return to the start of the waypoint data to do a "clean" copy */
gbfseek(mps_file_temp, tempFilePos, SEEK_SET);
if (mpsWptClass == MPSDEFAULTWPTCLASS) {
waypt_add(wpt);
} else {
- waypt_free(wpt);
+ delete wpt;
}
} else {
break;
if (data->refct == 1) {
return (waypoint*)data->data;
} else {
- return waypt_dupe((waypoint*)data->data);
+ return new waypoint(*(waypoint*)data->data);
}
}
xfree(data->name);
}
if ((data->type == wptdata) && (data->refct == 0)) {
- waypt_free((waypoint*)data->data);
+ delete (waypoint*)data->data;
}
xfree(data);
}
DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n",
data->name, data->visible ? "yes" : "NO", data->objid));
- data->data = wpt = waypt_new();
+ data->data = wpt = new waypoint;
wpt->shortname = QString::fromLatin1(data->name);
time = data->mtime;
/* FIXME: At this point this waypoint maybe not fully loaded (initialized) !!!
We need a final procedure to handle this !!! */
if (! tmp->loaded) {
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = 0;
wpt->longitude = 0;
xasprintf(&wpt->shortname, "\01%p", tmp);
waypoint* wpt;
char unk;
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = gbfgetdbl(fin);
wpt->longitude = gbfgetdbl(fin);
}
if (global_opts.masked_objective & TRKDATAMASK) {
- trkpt = waypt_new();
+ trkpt = new waypoint;
trkpt->SetCreationTime(timestamp);
trkpt->latitude = latitude;
trkpt->longitude = longitude;
}
if (global_opts.masked_objective & WPTDATAMASK) {
- waypt = waypt_new();
+ waypt = new waypoint;
waypt->SetCreationTime(timestamp);
waypt->latitude = latitude;
waypt->longitude = longitude;
static route_head* trk_head = NULL;
static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm)
{
- waypoint* trk = waypt_new();
+ waypoint* trk = new waypoint;
if (global_opts.masked_objective& TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) {
char spds[50];
*/
if ((trk->fix == fix_unknown || trk->fix == fix_none) &&
trk->latitude - 90.0 < .000001 && trk->longitude < 0.000001) {
- waypt_free(trk);
+ delete trk;
return -1;
}
}
)
) {
/* Button press -- create waypoint, start count at 1 */
- waypoint* w = waypt_dupe(trk);
+ waypoint* w = new waypoint(*trk);
w->shortname = QString().sprintf("WP%06d", waypt_count()+1);
waypt_add(w);
NaviReadCache(const QXmlStreamReader& reader)
{
const QXmlStreamAttributes a = reader.attributes();
- waypoint* wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = new waypoint;
geocache_data* gc_data;
- gc_data = waypt_alloc_gc_data(wpt_tmp);
+ gc_data = wpt_tmp->AllocGCData();
if (a.hasAttribute("cache_id")) {
int n = a.value("cache_id").toString().toInt();
QString fn = QString("N%1").arg(n, 5, 16, QChar('0'));
if (a.hasAttribute("retired")) {
if (a.value("terrain").toString() == "yes" && noretired) {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
return;
}
}
for (int n = 0; n < nof_wp; ++n) {
- waypoint* wpt_tmp = waypt_new();
+ waypoint* wpt_tmp = new waypoint;
/* Read waypoint data */
for (wayptp = waypts; wayptp < waypts + MAX_WAYPOINTS; wayptp++) {
if (*wayptp) {
- waypt_free(*wayptp);
+ delete *wayptp;
}
}
static waypoint*
decode_waypoint(const unsigned char* buffer)
{
- waypoint* waypt = waypt_new();
+ waypoint* waypt = new waypoint;
decode_position(buffer + 12, waypt);
char* s = xstrdup((char*)buffer + 4);
static waypoint*
decode_trackpoint(const unsigned char* buffer)
{
- waypoint* waypt = waypt_new();
+ waypoint* waypt = new waypoint;
decode_position(buffer + 12, waypt);
waypt->SetCreationTime(decode_datetime(buffer + 22));
} else if (waypts[id] == NULL) {
fatal(MYNAME ": Non-existent waypoint in route\n");
} else {
- route_add_wpt(route, waypt_dupe(waypts[id]));
+ route_add_wpt(route, new waypoint(*waypts[id]));
}
}
}
if (w == MAX_WAYPOINTS) {
w = serial_write_waypoint_packet(waypt);
- route_waypts[w] = waypt_dupe(waypt);
+ route_waypts[w] = new waypoint(*waypt);
}
route_ids[route_id_ptr++] = w;
navilink_decode_logpoint(const unsigned char* buffer)
{
waypoint* waypt = NULL;
- waypt = waypt_new();
+ waypt = new waypoint;
waypt->hdop = ((unsigned char)buffer[0]) * 0.2f;
waypt->sat = buffer[1];
lon = gbfgetint32(fin);
lat = gbfgetint32(fin);
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = GPS_Math_Semi_To_Deg(lat & 0x7FFFFFFF);
wpt->longitude = GPS_Math_Semi_To_Deg(lon);
continue;
}
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
if (stealth) {
if (!snmac) {
/* This waypoint isn't queued.
Release it, because we don't have any reference to this
waypoint (! memory leak !) */
- waypt_free(wpt);
+ delete wpt;
}
}
hms = hms / 100;
tm.tm_hour = hms % 100;
- waypt = waypt_new();
+ waypt = new waypoint;
nmea_set_waypoint_time(waypt, &tm, fsec);
hms = hms / 100;
tm.tm_hour = (long) hms % 100;
- waypt = waypt_new();
+ waypt = new waypoint;
nmea_set_waypoint_time(waypt, &tm, fsec);
}
/* This point is both a waypoint and a trackpoint. */
if (amod_waypoint) {
- waypt_add(waypt_dupe(curr_waypt));
+ waypt_add(new waypoint(*curr_waypt));
amod_waypoint = 0;
}
return;
}
- waypt = waypt_new();
+ waypt = new waypoint;
WAYPT_SET(waypt, speed, KNOTS_TO_MPS(speed));
/* This point is both a waypoint and a trackpoint. */
if (amod_waypoint) {
- waypt_add(waypt_dupe(waypt));
+ waypt_add(new waypoint(*waypt));
amod_waypoint = 0;
}
}
&lngdeg,&lngdir,
sname);
- waypt = waypt_new();
+ waypt = new waypoint;
if (latdir == 'S') {
latdeg = -latdeg;
}
if (lat || lon) {
- curr_waypt = waypt_new();
+ curr_waypt = new waypoint;
curr_waypt->longitude = pcmpt_deg(lon);
curr_waypt->latitude = pcmpt_deg(lat);
/* for a quiet compiler */
zip1 = zip2 = city = street = number = QString();
- wpt = waypt_new();
+ wpt = new waypoint;
column = -1;
c = csv_lineparse(str, "|", "", column++);
if (wpt->wpt_flags.fmt_use) {
waypt_add(wpt);
} else {
- waypt_free(wpt);
+ delete wpt;
}
wpt = NULL;
}
static void
osm_node(xg_string args, const QXmlStreamAttributes* attrv)
{
- wpt = waypt_new();
+ wpt = new waypoint;
if (attrv->hasAttribute("id")) {
QString atstr = attrv->value("id").toString();
if (waypoints.contains(atstr)) {
ctmp = waypoints.value(atstr);
- tmp = waypt_dupe(ctmp);
+ tmp = new waypoint(*ctmp);
route_add_wpt(rte, tmp);
} else {
warning(MYNAME ": Way reference id \"%s\" wasn't listed under nodes!\n", CSTR(atstr));
switch (aktTyp) {
#ifdef WITH_BITMAP
case 1: // Bitmap
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = aktY;
wpt->longitude = aktX;
wpt->altitude = 0.0;
isSection = SECTION_SYMBOL;
break;
case 3: // Linie
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = aktY;
wpt->longitude = aktX;
wpt->altitude = 0.0;
if (buff.contains(',')) {
bool ozi_fsdata_used = false;
ozi_fsdata* fsdata = ozi_alloc_fsdata();
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
/* data delimited by commas, possibly enclosed in quotes. */
char* orig_s = xstrdup(CSTR(buff));
ozi_convert_datum(wpt_tmp);
track_add_wpt(trk_head, wpt_tmp);
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
break;
case rtedata:
if (!header) {
route_add_wpt(rte_head, wpt_tmp);
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
break;
case wptdata:
ozi_convert_datum(wpt_tmp);
waypt_add(wpt_tmp);
} else {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
break;
case posndata:
name[sizeof(name)-1] = '\0';
desc[sizeof(desc)-1] = '\0';
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->altitude = alt;
cp = lrtrim(name);
if (*cp != '\0') {
wpt_tmp->latitude = ddmm2degrees(lat);
}
if (route != NULL) {
- route_add_wpt(route, waypt_dupe(wpt_tmp));
+ route_add_wpt(route, new waypoint(*wpt_tmp));
}
waypt_add(wpt_tmp);
points++;
if (tm.tm_year < 70) {
tm.tm_year += 100;
}
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->SetCreationTime(mkgmtime(&tm));
if (read_as_degrees) {
wpt_tmp->longitude = lon;
tm.tm_min = le_readu16(&bc.minute);
tm.tm_sec = le_readu16(&bc.second);
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = le_read_float(&bc.latitude);
wpt->longitude = le_read_float(&bc.longitude);
wpt->altitude = FEET_TO_METERS(le_read_float(&bc.altitude));
void wpt_s(xg_string args, const QXmlStreamAttributes* unused)
{
if (isFirst == 1) {
- wpt_from = waypt_new();
+ wpt_from = new waypoint;
route = route_head_alloc();
route->rte_desc="PocketFMS flightplan";
route_add_head(route);
}
- wpt_to = waypt_new();
+ wpt_to = new waypoint;
}
void wpt_e(xg_string args, const QXmlStreamAttributes* unused)
if (isFirst == 1) {
route_add_wpt(route, wpt_from);
if (doing_wpts) {
- waypt_add(waypt_dupe(wpt_from));
+ waypt_add(new waypoint(*wpt_from));
}
wpt_from = NULL;
isFirst = 0;
}
route_add_wpt(route, wpt_to);
if (doing_wpts) {
- waypt_add(waypt_dupe(wpt_to));
+ waypt_add(new waypoint(*wpt_to));
}
wpt_to = NULL;
}
break;
}
linecount++;
- wpt = waypt_new();
+ wpt = new waypoint;
s = buff;
s = csv_lineparse(s, "\\w", "", linecount);
if (!s) {
}
if (((ed->state & INSIDE) == OUTSIDE) == (exclopt == NULL)) {
waypt_del(wp);
- waypt_free(wp);
+ delete wp;
}
xfree(ed);
}
switch (qtype) {
case wptdata:
waypt_del(comp[j]);
- waypt_free(comp[j]);
+ delete comp[j];
break;
case trkdata:
track_del_wpt(cur_rte, comp[j]);
default:
break;
}
- waypt_free(comp[i]);
+ delete comp[i];
}
}
}
waypoint* thisWaypoint;
if (strlen(psit_current_token) > 0) {
- thisWaypoint = waypt_new();
+ thisWaypoint = new waypoint;
thisWaypoint->latitude = atof(psit_current_token);
while (psit_isKnownToken(psit_current_token) != 0) {
if (strlen(psit_current_token) > 0) {
- thisWaypoint = waypt_new();
+ thisWaypoint = new waypoint;
thisWaypoint->latitude = atof(psit_current_token);
while (psit_isKnownToken(psit_current_token) != 0) {
if (strlen(psit_current_token) > 0) {
- thisWaypoint = waypt_new();
+ thisWaypoint = new waypoint;
thisWaypoint->latitude = atof(psit_current_token);
if ((dist >= pos_dist) == (exclopt == NULL)) {
waypt_del(waypointp);
- waypt_free(waypointp);
+ delete waypointp;
continue;
}
waypoint* wpt;
garmin_fs_t* gmsd;
- wpt = waypt_new();
+ wpt = new waypoint;
gmsd = garmin_fs_alloc(-1);
fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
break;
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->shortname = name;
wpt->latitude = atof(lat);
wpt->longitude = atof(lon);
fatal(MYNAME ": No associated waypoint for route point %s (Route %s)!\n",
str, CSTRc(rte->rte_name));
- route_add_wpt(rte, waypt_dupe(wpt));
+ route_add_wpt(rte, new waypoint(*wpt));
}
}
}
rte_new->rte_num = rte_old->rte_num;
any_route_add_head(rte_new, *dst);
QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) {
- any_route_add_wpt(rte_new, waypt_dupe((waypoint*)elem2), dst_wpt_count, 0, RPT, 3);
+ any_route_add_wpt(rte_new, new waypoint(*(waypoint*)elem2), dst_wpt_count, 0, RPT, 3);
}
(*dst_count)++;
}
lon = (0x80000000UL -
le_read32(&latlon->lat)) / (double)(0x800000);
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude = lat;
wpt_tmp->longitude = -lon;
if (control) {
double lat;
double lon;
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
lat = (0x80000000UL -
le_read32(&latlon->lat)) /
if (old_track_head) {
if (timesynth) {
track_add_wpt(old_track_head,
- waypt_dupe(wpt_tmp));
+ new waypoint(*wpt_tmp));
} else {
route_add_wpt(old_track_head,
- waypt_dupe(wpt_tmp));
+ new waypoint(*wpt_tmp));
}
old_track_head = NULL;
}
decode_sbn_record(unsigned char* buffer)
{
waypoint* waypt = NULL;
- waypt = waypt_new();
+ waypt = new waypoint;
if (is_sbn_valid(buffer)) {
waypt->fix = decode_sbn_mode(buffer + 3);
routehead->rte_name = name;
route_add_head(routehead);
for (j = 0; j < shp->nVertices; j++) {
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = shp->padfY[j];
wpt->longitude = shp->padfX[j];
wpt->altitude = shp->padfZ[j];
break;
case SHPT_POINT:
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = shp->dfYMin;
wpt->longitude = shp->dfXMin;
wpt->shortname = name;
fatal(MYNAME ": Incomplete line!\n");
}
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = atof(str + 21);
if (str[20] == 'S') {
static waypoint*
make_trackpoint(struct read_state* st, double lat, double lon, double alt)
{
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
xasprintf(&wpt->shortname, "TP%04d", ++st->tpn);
WAYPT_SET(tpt, speed, KPH_TO_MPS(ITEM_SPEED(pitem))); /* convert speed to m/s */
if (poi) {
- waypt_add(waypt_dupe(tpt));
+ waypt_add(new waypoint(*tpt));
}
if (0 == pst->route_head_) {
} else {
ECEF_to_LLA(ecef_x, ecef_y, ecef_z, &lat, &lng, &alt);
- wpt = waypt_new();
+ wpt = new waypoint;
xasprintf(&wpt->shortname, "POI_%s", poinames[poi]);
xasprintf(&wpt->description, "miniHomer points to this coordinates if the %s symbol is on", poinames[poi]);
wpt->latitude = lat;
}
(*waypt_del_fnp)((route_head*)(void*)rte,
(waypoint*)(void*)(xte_recs[i].intermed->wpt));
- waypt_free((waypoint*)(void*)(xte_recs[i].intermed->wpt));
+ delete (waypoint*)(void*)(xte_recs[i].intermed->wpt);
if (xte_recs[i].intermed->prev) {
xte_recs[i].intermed->prev->next = xte_recs[i].intermed->next;
stack = tmp_elt;
if (opt_copy) {
QUEUE_FOR_EACH(&(stack->waypts), elem, tmp) {
- waypt_add(waypt_dupe((waypoint*)elem));
+ waypt_add(new waypoint(*(waypoint*)elem));
}
}
warning(MYNAME ": Unknown point type %s at line %d!\n", str, lineno);
return;
}
- wpt = waypt_new();
+ wpt = new waypoint;
break;
case 1:
}
what = new_what;
- wpt = waypt_new();
+ wpt = new waypoint;
break;
case 1:
route = route_head_alloc();
route_add_head(route);
}
- route_add_wpt(route, waypt_dupe(wpt));
+ route_add_wpt(route, new waypoint(*wpt));
}
break;
if (route != NULL) {
if ((via != 0) || (routevia == NULL)) {
- waypoint* wpt = waypt_dupe(wpt_tmp);
+ waypoint* wpt = new waypoint(*wpt_tmp);
route_add_wpt(route, wpt);
}
}
if (via == 0) {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
}
wpt_tmp = NULL;
{
waypoints++;
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
if ((waypoints == 1) || (waypoints == item_count)) {
wpt_tmp->wpt_flags.fmt_use ++;
}
{
uint32_t i;
for (i = 0; i < tty_wpt_count; i++) {
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
wpt->shortname = (gbfgetcstr(fin));
wpt->description = (gbfgetcstr(fin));
}
if (sscanf(ibuf, "%lf,%lf:%100[^:]:%100[^\n]",
&lon, &lat, icon, desc)) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->longitude = lon;
wpt_tmp->latitude = lat;
/* skip the line if it contains "sHyperLink" as it is a header (I hope :) */
if ((strlen(buff)) && (strstr(buff, "sHyperLink") == NULL)) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
/* data delimited by tabs, not enclosed in quotes. */
s = buff;
}
if (i != 11) {
- waypt_free(wpt_tmp);
+ delete wpt_tmp;
warning(MYNAME ": WARNING - extracted %d fields from line %d. \nData on line ignored.\n",
i, linecount);
} else {
desc = (char*)xmalloc(recsize - 13);
gbfread(desc, recsize-13, 1, file_in);
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->longitude = x/100000.0;
wpt_tmp->latitude = y/100000.0;
#if 0 // Fallthrough for now to silently ignore these until this is done.
recsize = read_char(file_in) ;
check_recsize(recsize);
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
decode_latlon(&wpt_tmp->latitude, &wpt_tmp->longitude);
gbfread(tbuf, 3, 1, file_in);
gbfread(tbuf, 3, 1, file_in);
while (pointcount--) {
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
/* pascal-like shortname */
wpt_tmp->shortname = gbfgetpstr(tpg_file_in);
/* multiply all the deltas by the scaling factors to determine the waypoint positions */
for (j=0; j<waypoint_count; j++) {
- waypoint_temp = waypt_new();
+ waypoint_temp = new waypoint;
/* convert incoming NAD27/CONUS coordinates to WGS84 */
GPS_Math_Known_Datum_To_WGS84_M(
waypoint* waypoint_temp;
- waypoint_temp = waypt_new();
+ waypoint_temp = new waypoint;
latitude = (double)lat / 0x800000;
longitude = (double)lon / 0x800000;
// For routes (later), we need a duplicate of each waypoint
// indexed by the order we read them in.
- waypoint_temp2 = waypt_dupe(waypoint_temp);
+ waypoint_temp2 = new waypoint(*waypoint_temp);
// Attach the copy to our index
tpo_wp_index[tpo_index_ptr++] = waypoint_temp2;
//printf("val: %x\t\t", val);
// Duplicate a waypoint from our index of waypoints.
- waypoint_temp = waypt_dupe(tpo_wp_index[val-1]);
+ waypoint_temp = new waypoint(*tpo_wp_index[val-1]);
// Add the waypoint to the route
route_add_wpt(route_temp, waypoint_temp);
// Free the waypoint index, we don't need it anymore.
for (i = 0; i < tpo_index_ptr; i++) {
- waypt_free(tpo_wp_index[i]);
+ delete tpo_wp_index[i];
}
tpo_index_ptr = 0;
QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) {
waypoint* wpt = (waypoint*)elem;
track_del_wpt((route_head*)track, wpt);
- waypt_free(wpt);
+ delete wpt;
}
track_del_head((route_head*)track);
return;
QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) {
wpt = (waypoint*)elem;
if (wpt->creation_time.isValid()) {
- buff[j++] = waypt_dupe(wpt);
+ buff[j++] = new waypoint(*wpt);
}
track_del_wpt(track, wpt);
- waypt_free(wpt);
+ delete wpt;
}
if (track != master) { /* i > 0 */
track_del_head(track);
route_add_wpt(master, wpt);
prev = wpt;
} else {
- waypt_free(wpt);
+ delete wpt;
dropped++;
}
}
if (! inside) {
track_del_wpt(track, wpt);
- waypt_free(wpt);
+ delete wpt;
dropped++;
}
}
waypoint* wpt = (waypoint*) elem;
#endif
- wpt = waypt_dupe(wpt);
+ wpt = new waypoint(*wpt);
switch (current_target) {
case 'R':
route_add_wpt_named(rte, wpt, RPT, name_digits);
static void
transform_any_disp_wpt_cb(const waypoint* wpt)
{
- waypoint* temp = waypt_dupe(wpt);
+ waypoint* temp = new waypoint(*wpt);
if (current_target == 'R') {
route_add_wpt_named(current_rte, temp, current_namepart, name_digits);
} else if (current_target == 'T') {
int ns = 1;
int ew = 1;
geocache_data* gc_data = NULL;
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = unicsv_unknown;
wpt->longitude = unicsv_unknown;
memset(&ymd, 0, sizeof(ymd));
case fld_gc_placer_id:
case fld_gc_hint:
- gc_data = waypt_alloc_gc_data(wpt);
+ gc_data = wpt->AllocGCData();
switch (unicsv_fields_tab[column]) {
}
if (checked == 0) {
- waypt_free(wpt);
+ delete wpt;
return;
}
}
}
- if (! waypt_empty_gc_data(wpt)) {
+ if (! wpt->EmptyGCData()) {
const geocache_data* gc_data = wpt->gc_data;
if (gc_data->id) {
unicsv_print_str(GMSD_GET(email, NULL));
}
- if (waypt_empty_gc_data(wpt)) {
+ if (wpt->EmptyGCData()) {
gc_data = NULL;
} else {
gc_data = wpt->gc_data;
line.bas.cr = 0; /* null terminate vox field */
}
- wpt = waypt_new();
+ wpt = new waypoint;
/* lat is a string in the form: 31.768380N */
c = line.bas.common.latitude_NS; /* N/S */
// thread on gpsbabel-misc with Jamie Robertson.
assert(line.bas.common.tag == 'C' || line.bas.common.tag == 'G' ||
line.bas.common.tag == 'V');
- wpt2 = waypt_dupe(wpt);
+ wpt2 = new waypoint(*wpt);
if (line.bas.common.tag == 'V') { // waypoint with voice recording?
char vox_file_name[sizeof(line.adv.vox)+5];
const char* vox = is_advanced_mode ? line.adv.vox : line.bas.vox;
route_head* trk = NULL;
while (! gbfeof(fin)) {
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
wpt->latitude = gbfgetdbl(fin);
wpt->longitude = gbfgetdbl(fin);
gpsvalid =gbfgetc(infile); /* fix is valid */
gpssats =gbfgetc(infile); /* number of sats */
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude =DEG(latrad);
wpt_tmp->longitude =DEG(lonrad);
course = gbfgetint16(infile);
status = gbfgetint32(infile);
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
wpt_tmp->latitude = scaled_lat / vitovtt_latitudescale;
wpt_tmp->longitude = scaled_lon / vitovtt_longitudescale;
ymd /= 100;
tm.tm_year = ymd % 100 + 100;
- waypt = waypt_new();
+ waypt = new waypoint;
// Lat/Lon are both stored *0xE1000 which we have to divide out
// for decimal degrees
#endif
}
-// This whole thing is a poor-man's copy constructor. It exists mostly
-// as a bridge from our non-reference counted C types to classes now.
-waypoint*
-waypt_dupe(const waypoint* wpt)
-{
- return new waypoint(*wpt);
-}
-
void update_common_traits(const waypoint* wpt)
{
/* This is a bit tacky, but it allows a hint whether we've seen
#endif
}
-/*
- * A constructor for a single waypoint.
- */
-waypoint*
-waypt_new(void)
-{
- waypoint* wpt = new waypoint;
- return wpt;
-}
-
unsigned int
waypt_count(void)
{
return NULL;
}
-void
-waypt_free(waypoint* wpt)
-{
- delete wpt;
-}
-
#if NEWQ
void
waypt_flush(queue* head)
{
while (!waypt_list.isEmpty()) {
- waypt_free(waypt_list.takeFirst());
+ delete waypt_list.takeFirst();
}
}
#else
QUEUE_FOR_EACH(head, elem, tmp) {
waypoint* q = (waypoint*) dequeue(elem);
- waypt_free(q);
+ delete q;
if (head == &waypt_head) {
waypt_ct--;
}
QUEUE_FOR_EACH(qbackup, elem, tmp) {
wpt = (waypoint*)elem;
- waypt_add(waypt_dupe(wpt));
+ waypt_add(new waypoint(*wpt));
no++;
}
}
}
-geocache_data*
-waypt_alloc_gc_data(waypoint* wpt)
-{
- return wpt->AllocGCData();
-}
-
-int
-waypt_empty_gc_data(const waypoint* wpt)
-{
- return wpt->EmptyGCData();
-}
-
-
waypoint::waypoint() :
// Q(),
latitude(0), // These should probably use some invalid data, but
static waypoint* make_point(double lat, double lon, double alt, time_t tim, const char* fmt, int index)
{
char wp_name[20];
- waypoint* wpt = waypt_new();
+ waypoint* wpt = new waypoint;
sprintf(wp_name, fmt, index);
char desc[255] ="\0";
if ((ap_hdop>=1)&&(ap_hdop<50)) { // Discard invalid GPS fix
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
if (snmac) {
wpt_tmp->shortname = ap_mac;
int16_t alt = gbfgetint16(fin); // Signed. Meters.
(void) flags; // Silence 'unused' warning until we use flags.
- wpt = waypt_new();
+ wpt = new waypoint;
wpt->latitude = latitude / 1.0e7;
wpt->longitude = longitude / 1.0e7;
wpt->SetCreationTime(wintec_date_to_time(date));
// Wintec's software puts a waypoint in the track, so we
// mock that.
if (flags & 0x02) {
- waypoint* temp = waypt_dupe(wpt);
+ waypoint* temp = new waypoint(*wpt);
waypt_add(temp);
}
{
if (attrv->hasAttribute("type")) {
if (attrv->value("type") == "waypoint") {
- wpt = waypt_new();
+ wpt = new waypoint;
} else if (attrv->value("type") == "polyline") {
trk = route_head_alloc();
track_add_head(trk);
void wpt_s(xg_string args, const QXmlStreamAttributes* unused)
{
- wpt_tmp = waypt_new();
+ wpt_tmp = new waypoint;
}
void wpt_e(xg_string args, const QXmlStreamAttributes* unused)